home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
general
/
raytrace
/
rayshade
/
graphtal.lzh
/
Graphtal.Amiga
/
Ray.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-17
|
1KB
|
47 lines
/*
* Ray.C
*
* Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
* University of Berne, Switzerland
* All rights reserved.
*
* This software may be freely copied, modified, and redistributed
* provided that this copyright notice is preserved on all copies.
*
* You may not distribute this software, in whole or in part, as part of
* any commercial product without the express consent of the authors.
*
* There is no warranty or other guarantee of fitness of this software
* for any purpose. It is provided solely "as is".
*
*/
#include "Ray.h"
#include "transform.h"
//___________________________________________________________ Ray
Ray::Ray(const Vector& origin, const Vector& direction)
: orig(origin), dir(direction)
{}
real Ray::transform(const TransMatrix& tmat)
{
orig = orig*tmat;
/*
* apply the transformation to the direction
* (translations has no effect)
*/
dir = vectorTransform(dir, tmat);
/*
* compute the that the ray is stretched due to the transformation
*/
real d = dir.length();
dir.normalize();
return d;
}